﻿using System;
using System.Linq;
using System.Threading;

namespace ShowTimeConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                GetTime();
                Thread.Sleep(3000);
            }
            Console.ReadLine();
        }

        private static void GetTime()
        {
            var m = -new Random().Next(0, 100);
            var time = DateTime.Now.AddMinutes(m);
            Console.WriteLine(m);
            //Console.WriteLine(time);
            var timeCover = DateTime.Now - time;
            var allm = Convert.ToInt32(Math.Ceiling(timeCover.TotalSeconds));
            var remarks = new string[] { "秒前", "分钟前", "小时前" };

            var max = Math.Pow(60, 4);

            var remark = remarks.FirstOrDefault(item => allm > (max /= 60)) ?? "刚刚";

            var t2 = (allm / max);

            var result = string.Format("{1} {0}", remark, t2).Trim();

            Console.WriteLine(result);
        }
    }
}
